package com.milkmangames.extensions
{
	import flash.events.*;
	import flash.external.*;

/** Our Native Extension */
public class OurExtension extends EventDispatcher
{
	//
	// Instance Variables
	//
	
	/** Extension Context */
	private var extContext:ExtensionContext;
	
	//
	// Public Methods
	//
	
	/** Create New OurExtension */
	public function OurExtension()
	{
		this.extContext=ExtensionContext.createExtensionContext("com.milkmangames.extensions.OurExtension","");
		this.extContext.addEventListener(StatusEvent.STATUS, onExtStatus);
	}
	
	/** Show Message Box */
	public function showMessageBox(message:String):void
	{
		this.extContext.call("showMessageBox",message);
	}
	
	//
	// Events
	//
	
	/** On Extension Status Update */
	private function onExtStatus(e:StatusEvent):void
	{
		switch(e.code)
		{
			case "COMPLETE":
				dispatchEvent(new Event(Event.COMPLETE));
				break;
			default:
				trace("Unknown event type: "+e.code);
				break;
		}
	}
}
}